<%@ LANGUAGE="VBSCRIPT" %>
<% OPTION EXPLICIT %>
<%'- ------------------------------------------------------------
  '-  UserGroupList.asp
  '-  This ASP is for internal IDMWS use only.  The interface may
  '-  change at any time.
  '-  
  '-  This page provides XML access to the Users and Groups of
  '-  a library.
  '-
  '-  Calling syntax:
  '-  Parameter		Allowed values		Means
  '-  library		<string>			Library Name.
  '-  Type			<string>			either key_User or key_Group
  '-									It can be repeated to include both
  '- 
  '-  ------------------------------------------------------------
  '-  VCS INFO:
  '-  
  '-  $Revision:   1.1  $
  '-  $Date:   01 Jun 2000 14:04:46  $
  '-  $Author:   vpham  $
  '-  $Workfile:   usergrouplist.asp  $
  '-  ------------------------------------------------------------
  '-  All Rights Reserved.  Copyright (c) 1998-1999 FileNET Corp.
  '-  ------------------------------------------------------------
%>
<%
	dim querystring
	dim lib, CurrLogonID
	CurrLogonID = Request.QueryString ("LogonID")
	if (Len(CurrLogonID) <= 0) then
		Response.Expires = 0
		Response.Status = "403 Forbidden"
		Response.ContentType = "text/plain"
		Response.Write "Not logged on or session timed out ... please logon."
		Response.End
	end if
	querystring = Request.ServerVariables("QUERY_STRING")
	if Len(querystring) then
		querystring = "?" + querystring
	end if
	On Error Resume Next
	set lib = Server.CreateObject("IDMObjects.Library")
	if Len(Err.Description) then
		Response.Expires = 0
		Response.Status = "404 Not Found"
		Response.ContentType = "text/plain"
        Response.Write "Object not found: "
        Response.Write Err.Description
		Response.End
	end if
	lib.LogonID = CurrLogonID

	'Response.Write "Got here #1; "
	dim bIncludeUsers
	dim bIncludeGroups
	bIncludeUsers = False
	bIncludeGroups = False
	dim numTypes
	numTypes = Request.QueryString("Type").Count
	'Response.Write "Number of types in request = " & CStr(numTypes) & "; "
	dim iType
	dim strType
	For iType = 1 To numTypes
		'Response.Write "Type #" & CStr(iType) & "; "
		strType = Request.QueryString("Type")(iType)
		'Response.Write "Type #" & CStr(iType) & "= " & strType & "; "
		if strType = "key_User" then
			bIncludeUsers = True
		elseif strType = "key_Group" then
			bIncludeGroups = True
		end if
	Next
	'Response.Write "Got here #2; "
	dim xmlhlp
	On Error Resume Next
	set xmlhlp = Server.CreateObject("IDMWeb.XMLHelper")
	if Len(Err.Description) then
		Response.Expires = 0
		Response.Status = "404 Not Found"
		Response.ContentType = "text/plain"
        Response.Write "Object not found: "
        Response.Write Err.Description
		Response.End
	end if

	dim strxml
	'Response.Write "Start calling MakeSecurityMembersXML"
	On Error Resume Next
	strxml = xmlhlp.MakeSecurityMembersXML(lib, bIncludeUsers, bIncludeGroups)
	if Len(Err.Description) then
		Response.Expires = 0
		Response.Status = "404 Not Found"
		Response.ContentType = "text/plain"
        Response.Write "Error return from MakeSecurityMembersXML: "
        Response.Write Err.Description
		Response.End
	end if
	Response.BinaryWrite strxml
%>
